package test.baojia.act.operation;

import com.alibaba.fastjson.JSONObject;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;

import java.util.Properties;

/**
 * 双击事件。
 */
public class DoubleClickOperation extends Operation {

    @Override
    public void run(JSONObject context, WebDriver driver, Properties resource, JSONObject parentContext) throws  Exception {
        super.run(context, driver, resource, parentContext);
        this.newWebDriverWait(null).until(
                ExpectedConditions.elementToBeClickable(this.makeBy())
        );
        Actions writeLetterAction = new Actions(driver);
        writeLetterAction.doubleClick(this.makeWebElement(true)).perform();
    }
}
